home *** CD-ROM | disk | FTP | other *** search
/ Softwarová Záchrana 3 / Softwarova-zachrana-3.bin / Xteq X-Setup / xqdcXSP-Setup-EN.exe / {app} / plugins / XQ Script Files 1.xpl < prev    next >
Text File  |  2004-01-24  |  3KB  |  120 lines

  1. "FILE"="Xteq Systems X-Setup Plugin 6.0"
  2. "TYPE"="6"
  3. "COUNT"="3"
  4. "UIPATH 1"="System\Security\File System"
  5. "UIPATH 2"="Appearance\Files&Folders\Files"
  6. "UIPATH 3"="Program Options\Built in Windows Apps\Windows Scripting Host"
  7. "NAME"="Script Files"
  8. "LANGUAGE"="VBScript"
  9. "VERSION"="1.07"
  10. "TEXT 1"="Open *.VBS/*.VBE with Notepad when opened"
  11. "TEXT 2"="Open *.JS/*.JSE with Notepad when opened"
  12. "TEXT 3"="Open *.WSH/*.WSF with Notepad when opened"
  13. "DESCRIPTION 1"="Script files are powerful to automate common tasks but they are also a security problem. Some mad people use script files to create viruses (e.g. the "I LOVE YOU" virus in May 2000) so it's better to have a look at the files before executing them."
  14. "DESCRIPTION 2"="If the checkbox is activated, a double click on a script file will open Notepad instead of executing the script. This way, you can review the file before executing it. "
  15. "DESCRIPTION 3"="After this review, just select the file, right click and select "Open" from the appearing menu to execute the script finally."
  16. "AUTHOR"="Xteq Systems"
  17. "CONTACTURL"="http://www.xteq.com"
  18. "COPYRIGHT"="Copyright ⌐ Xteq Systems - All Rights Reserved"
  19. "COMMENT 1"="Thanks to sampabw for the bug notice!"
  20.  
  21.  
  22.  
  23.  
  24.  
  25. sDefault_a="HKCR\"
  26. sDefault_b="\Shell\@"
  27. sDefault_Value="Edit"
  28. sDefault_Edit_a="HKCR\"
  29. sDefault_Edit_b="\Shell\Edit\Command\@"
  30. sDefault_Edit_Cmd="Notepad.exe %1"
  31.  
  32. sP1a="HKCR\.VBS\@"
  33. sP1b="HKCR\.VBE\@"
  34.  
  35. sP2a="HKCR\.JS\@"
  36. sP2b="HKCR\.JSE\@"
  37.  
  38. sP3a="HKCR\.WSH\@"
  39. sP3b="HKCR\.WSF\@"
  40.  
  41. Sub Plugin_Initialize 
  42.  b1=ReadStatus(sP1a)
  43.  b2=ReadStatus(sP1b)
  44.  if b1=true and b2=true then SetUIElement 1,true
  45.  
  46.  b1=ReadStatus(sP2a)
  47.  b2=ReadStatus(sP2b)
  48.  if b1=true and b2=true then SetUIElement 2,true
  49.  
  50.  b1=ReadStatus(sP3a)
  51.  b2=ReadStatus(sP3b)
  52.  if b1=true and b2=true then SetUIElement 3,true
  53. End Sub
  54.  
  55. Sub Plugin_CheckData(ElementIndex)
  56. End Sub
  57.  
  58. Sub Plugin_Apply(ElementIndex,ElementSubIndex)
  59.  Call WriteChanges(sP1a,GetUIElement(1))
  60.  Call WriteChanges(sP1b,GetUIElement(1))
  61.  
  62.  Call WriteChanges(sP2a,GetUIElement(2))
  63.  Call WriteChanges(sP2b,GetUIElement(2))
  64.  
  65.  Call WriteChanges(sP3a,GetUIElement(3))
  66.  Call WriteChanges(sP3b,GetUIElement(3))
  67. End Sub
  68.  
  69. Sub Plugin_Terminate 
  70. End Sub
  71.  
  72.  
  73. Function ReadStatus(key)
  74.  s=RegReadValue(key)
  75.  'Debugmsg s
  76.  
  77.  'if this value is empty, the script file does simply not exist so 
  78.  'set it to false
  79.  if IsEmpty(s)=true or len(s)=0 then
  80.     ReadStatus=false
  81.  else
  82.     s=sDefault_a & s & sDefault_b
  83.     s=RegReadValue(s)
  84.     if s=sDefault_Value then
  85.        ReadStatus=true
  86.     else
  87.        ReadStatus=false
  88.     end if
  89.  end if
  90. End Function
  91.  
  92. Sub WriteChanges(key,activated)
  93.  sPathFirst=RegReadValue(key)
  94.  'Debugmsg s
  95.  
  96.  'same as above. If empty, simply ignore it...
  97.  if IsEmpty(sPathFirst)=true or len(sPathFirst)=0 then
  98.     'bye bye
  99.  else
  100.     sPath=sDefault_a & sPathFirst & sDefault_b
  101.     v=RegReadValue(sPath)
  102.  
  103.     if activated=false then 'EXECUTE!
  104.        if IsEmpty(v)=false then
  105.           RegDeleteValue sPath
  106.        end if
  107.     else 'DEACTIVATE
  108.        RegWriteValue sPath,sDefault_Value,1
  109.        'check if "EDIT" exists
  110.        sPath=sDefault_Edit_a & sPathFirst & sDefault_Edit_b
  111.        v=RegReadValue(sPath)
  112.        if IsEmpty(v) then
  113.           RegWriteValue sPath,sDefault_Edit_Cmd,1
  114.        end if
  115.     end if
  116.  end if
  117. End Sub
  118.  
  119.  
  120.